From deda31fd070eaf053dbbcf51f102ea6d25c75d73 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 23 Jun 2017 08:45:12 -0700 Subject: [PATCH] Switch `cargo search` output to stdout Closes #4203 --- src/cargo/ops/registry.rs | 12 +++++------- tests/search.rs | 4 ++-- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/cargo/ops/registry.rs b/src/cargo/ops/registry.rs index 35ec30257..42ecdf6bf 100644 --- a/src/cargo/ops/registry.rs +++ b/src/cargo/ops/registry.rs @@ -423,19 +423,17 @@ pub fn search(query: &str, } None => name }; - writeln!(config.shell().err(), "{}", line)?; + println!("{}", line); } let search_max_limit = 100; if total_crates > limit as u32 && limit < search_max_limit { - writeln!(config.shell().err(), - "... and {} crates more (use --limit N to see more)", - total_crates - limit as u32)?; + println!("... and {} crates more (use --limit N to see more)", + total_crates - limit as u32); } else if total_crates > limit as u32 && limit >= search_max_limit { - writeln!(config.shell().err(), - "... and {} crates more (go to http://crates.io/search?q={} to see more)", + println!("... and {} crates more (go to http://crates.io/search?q={} to see more)", total_crates - limit as u32, - percent_encode(query.as_bytes(), QUERY_ENCODE_SET))?; + percent_encode(query.as_bytes(), QUERY_ENCODE_SET)); } Ok(()) diff --git a/tests/search.rs b/tests/search.rs index ff224fe95..db99d8ddf 100644 --- a/tests/search.rs +++ b/tests/search.rs @@ -84,7 +84,7 @@ fn simple() { assert_that(cargo_process("search").arg("postgres") .arg("--host").arg(registry().to_string()), execs().with_status(0) - .with_stderr_contains("\ + .with_stdout_contains("\ hoare = \"0.1.1\" # Design by contract style assertions for Rust")); } @@ -134,7 +134,7 @@ fn multiple_query_params() { assert_that(cargo_process("search").arg("postgres").arg("sql") .arg("--host").arg(registry().to_string()), execs().with_status(0) - .with_stderr_contains("\ + .with_stdout_contains("\ hoare = \"0.1.1\" # Design by contract style assertions for Rust")); } -- 2.30.2